this.device = device;
this.device._delegate = this;
this._stateChangedId = this.device.connect('state-changed', Lang.bind(this, this._deviceStateChanged));
+ this._activeConnectionChangedId = this.device.connect('notify::active-connection', Lang.bind(this, this._activeConnectionChanged));
} else if (this.device) {
this.device._delegate = null;
GObject.Object.prototype.disconnect.call(this.device, this._stateChangedId);
this._stateChangedId = 0;
}
+ if (this._activeConnectionChangedId) {
+ GObject.Object.prototype.disconnect.call(this.device, this._activeConnectionChangedId);
+ this._stateChangedId = 0;
+ }
if (this._carrierChangedId) {
GObject.Object.prototype.disconnect.call(this.device, this._carrierChangedId);
this._carrierChangedId = 0;
return this.device && this.device.state == NetworkManager.DeviceState.ACTIVATED;
},
- clearActiveConnection: function(activeConnection) {
- this.setActiveConnection(null);
- },
+ _activeConnectionChanged: function() {
+ let activeConnection = this.device.active_connection;
- setActiveConnection: function(activeConnection) {
if (activeConnection == this._activeConnection)
// nothing to do
return;
this._activeNetwork = this._networks[res.network];
}
- // we don't refresh the view here, setActiveConnection will
+ // we don't refresh the view here, _activeConnectionChanged will
},
_getApSecurityType: function(accessPoint) {
}
},
- clearActiveConnection: function(activeConnection) {
+ removeActiveConnection: function(activeConnection) {
let pos = this._findConnection(activeConnection.uuid);
if (pos < 0)
return;
}
},
- setActiveConnection: function(activeConnection) {
+ addActiveConnection: function(activeConnection) {
let pos = this._findConnection(activeConnection.uuid);
if (pos < 0)
return;
for (let i = 0; i < closedConnections.length; i++) {
let a = closedConnections[i];
- if (a._primaryDevice) {
- a._primaryDevice.clearActiveConnection(a);
- a._primaryDevice = null;
- }
+ if (a._type == NetworkManager.SETTING_VPN_SETTING_NAME)
+ this._vpnSection.removeActiveConnection(a);
if (a._inited) {
a.disconnect(a._notifyStateId);
a.disconnect(a._notifyDefaultId);
active_vpn = a;
if (!a._primaryDevice) {
- if (a._type != NetworkManager.SETTING_VPN_SETTING_NAME)
+ if (a._type != NetworkManager.SETTING_VPN_SETTING_NAME) {
// This list is guaranteed to have one device in it.
a._primaryDevice = a.get_devices()[0]._delegate;
- else
+ } else {
a._primaryDevice = this._vpnSection;
-
- if (a._primaryDevice)
- a._primaryDevice.setActiveConnection(a);
+ this._vpnSection.addActiveConnection(a);
+ }
if (a.state == NetworkManager.ActiveConnectionState.ACTIVATED
&& a._primaryDevice && a._primaryDevice._notification) {